package com.dc.base.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2 // 启用swagger2
public class SwaggerConfig {
    @Bean
    public Docket swaggerPlugin() {
        return new Docket(DocumentationType.SWAGGER_2)
                // 接口文档信息
                .apiInfo(new ApiInfoBuilder()
                        .title("标题：东臣_顶岗实习陶瓷自动化平台_接口文档")
                        .description("描述：基础接口文档模版")
                        .contact(new Contact("邓朝福", "相关链接", "576948461@qq.com"))
                        .version("版本号:1.0.0")
                        .build())
                .select()
                // 生成带有ApiOperation注解的接口
                .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
                .build();
    }
}